package com.ldzy.controller;

import com.ldzy.Exception.MyException;
import com.ldzy.utiln.Respones;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
@ControllerAdvice
public class MyExceptionAdvice {
    @ExceptionHandler(MyException.class)
    @ResponseBody
    public Respones doMyException(MyException e){
        Respones respones=new Respones(101,e.getMessage());
        return  respones;
    }
}
